package app.demo.controller.base;

import org.apache.poi.hssf.record.formula.functions.T;
import org.springleaf.core.mvc.controller.BaseController;

/**
 * 用户Controller
 * @author leaf
 *
 */
@SuppressWarnings("hiding")
public class UserBaseController extends BaseController{
	
	public static final String CURRUSER = "_currUser";
	
	/**
	 * 得到当前用户
	 * @return
	 */
	public <T> T getUser(){
		return getSesAttr(CURRUSER);
	}
	
	/**
	 * 设置当前用户
	 * @param user
	 */
	public void setUser(Object user){
		setSesAttr(CURRUSER, user);
	}
	
	/**
	 * 清空当前保存着的用户
	 */
	public <T> T clearUser(){
		T user = getUser();
		removeSesAttr(CURRUSER);
		return user;
	}

}
